<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/11/7
  Time: 15:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Add</title>
</head>
<body>
   <div>
       <div style="color:red">${errorMsg}</div>
       <form action="add" method="post" enctype="multipart/form-data">
           <div>
               账号：<input type="text" name="account" id="account"><span style="color: red">${accountError}</span>
           </div>
           <div>
               真实姓名：<input type="text" name="realName"><span style="color: red">${realNameError}</span>
           </div>
           <div>
               密码：<input type="text" name="password"><span style="color: red">${passwordError}</span>
           </div>
           <div>
               性别:<input type="radio" value="1" name="sex">女 <input type="radio" value="2" name="sex">男
           </div>
           <div>
               出生日期：<input type="text" name="birthday"><span style="color: red">${birthdayError}</span>
           </div>
           <div>
               地址:<input type="text" name="address">
           </div>
           <div>
               角色:<select name="roleId">
               <option value="1">管理系统员</option>
               <option value="2">管理系统员</option>
               <option value="3">管理系统员</option>
           </select>
           </div>

           <div>
               证件照:
               <input type="file" name="idPic"><span style="color: red">${idPicError}</span>
           </div>

           <div>
               <input type="submit">
           </div>
       </form>
   </div>
   <script src="${pageContext.request.contextPath}/statics/layui/layui/layui.js" charset="utf-8"></script>
   <script>
       layui.use(['jquery'],function (){
           var $ = layui.$;

           $('#account').blur(function () {
               $.get('accountExists?account='+this.value,function (data) {
                   if(data=='1'){
                       //存在
                       $('#account').next().html('该账号已存在')
                   } else{
                       // 不存在
                       $('#account').next().html('')
                   }
               });
           });

       })
   </script>
</body>
</html>
